package com.huatai.dataservice.fire.firemodel;

/**
 * @author gaowengui
 * 时间间隔枚举类
 */
public enum TimePeriodEnum {
	BEFORE_DAWN("0-6点", 0, 6),
	MORNING("6-12点", 6, 12),
	AFTERNOON("12-18点", 12, 18),
	EVENING("18-24点", 18, 24);

	private final String displayName;
	private final int startHour;
	private final int endHour;

	TimePeriodEnum(String displayName, int startHour, int endHour) {
		this.displayName = displayName;
		this.startHour = startHour;
		this.endHour = endHour;
	}

	public static TimePeriodEnum getPeriod(int hour) {
		for (TimePeriodEnum period : values()) {
			if (hour >= period.startHour && hour < period.endHour) {
				return period;
			}
		}
		throw new IllegalArgumentException("无效小时值: " + hour);
	}

	public String getDisplayName() {
		return displayName;
	}
}
